const { defineConfig } = require('@vue/cli-service')

module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: "/",
  configureWebpack: {
    resolve: {
      //配置路径别名
      alias: {
        'common': '@/common',
        'network': '@/network',
        'theme': '@/theme',
        'style': '@/style',
        'components': '@/components',
        'router': '@/router',
        'store': '@/store',
        'utils': '@/utils',
        'views': '@/views',
        'pages': '@/pages',
        'constants': '@/constants',
        'assets': '@/assets',

      }
    }
  },
  chainWebpack: config => {
    const oneOfsMap = config.module.rule('scss').oneOfs.store
    oneOfsMap.forEach(item => {
      item
        .use('sass-resources-loader')
        .loader('sass-resources-loader')
        .options({
          // 要公用的scss的路径
          resources: [
            './src/style/umy-ui/index.scss', 
            './src/style/common.scss"', 
            './src/style/element-custom.scss', 
        ]
        })
        .end()
    })
  },
  devServer: {
    host: "localhost",
    proxy: {
      '/api': {
        target: 'http://localhost:3000',
        pathRewrite: { '^/api': '' },
        changeOrigin: true
      },
      "/webservice": {
        target: "http://10.106.0.231:8000",
        changeOrigin: false,
        secure: false,
      },
    }
  }
})

